﻿var v = new Vue({
    el:'#app',
    data () {
        return {
            id: null,
            name: '',
            pass: '',
            beizhu: ''
        }
        },
    methods:{
        clearData(){
            this.name = '';
            this.pass = '';
            this.beizhu = '';
        },
        register(){
            axios({
                url:'user/register.do',
                method:'post',
                data:{
                    name:this.name,
                    pass:this.pass,
                    beizhu:this.beizhu
                }

            }).then(function (res) {
                if(res.data.result=='success'){
                    alert('保存成功！');
                    //关闭模态框
                    $('#register').modal('hide');
                    v.clearData();
                }else{
                    alert('保存失败！');
                }

            }).catch(function (reason) {

            });
        }
    }});